home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 23 / AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso / Tools / Text-Viewer / MSWordView / mswordview_src / configure.in < prev    next >
Encoding:
Text File  |  1999-11-06  |  5.3 KB  |  214 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(mswordview.c)
  3. AC_CONFIG_HEADER(config.h)
  4.  
  5. dnl Checks for programs.
  6. dnl AC_PROG_CC
  7. dnl AC_PROG_CC shoves in -g by default, i *really* hate this so here goes...
  8. dnl ill shove in the autoconf def of AC_PROG_CC verbatim and remove the -g 
  9. dnl stuff
  10. dnl autoconf stuff begins here
  11.  
  12. AC_DEFUN(AC_PROG_CC_NO_G,
  13. [AC_BEFORE([$0], [AC_PROG_CPP])dnl
  14. AC_CHECK_PROG(CC, gcc, gcc)
  15. if test -z "$CC"; then
  16.   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
  17.   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
  18. fi
  19.  
  20. AC_PROG_CC_WORKS
  21. AC_PROG_CC_GNU
  22.  
  23. if test $ac_cv_prog_gcc = yes; then
  24.   GCC=yes
  25. dnl Check whether -g works, even if CFLAGS is set, in case the package
  26. dnl plays around with CFLAGS (such as to build both debugging and
  27. dnl normal versions of a library), tasteless as that idea is.
  28.   ac_test_CFLAGS="${CFLAGS+set}"
  29.   ac_save_CFLAGS="$CFLAGS"
  30.   CFLAGS=
  31. dnl   C Begin
  32. dnl AC_PROG_CC_G
  33. dnl   C End
  34.   if test "$ac_test_CFLAGS" = set; then
  35.     CFLAGS="$ac_save_CFLAGS"
  36. dnl   C Begin
  37. dnl  elif test $ac_cv_prog_cc_g = yes; then
  38. dnl    CFLAGS="-g -O2"
  39. dnl   C End
  40.   else
  41.     CFLAGS="-O2"
  42.   fi
  43. else
  44.   GCC=
  45.   test "${CFLAGS+set}" = set 
  46. dnl   C Begin
  47. dnl || CFLAGS="-g"
  48. dnl   C End
  49. fi
  50. ])
  51.  
  52. dnl autoconf stuff ends here
  53.  
  54. AC_PROG_CC_NO_G
  55. AC_PROG_MAKE_SET
  56. AC_PROG_INSTALL
  57.  
  58. AC_HEADER_STDC
  59. AC_HEADER_SYS_WAIT
  60. AC_TYPE_SIGNAL
  61. AC_FUNC_WAIT3
  62.  
  63. AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h unistd.h)
  64. CFLAGS="$CFLAGS $X_CFLAGS"
  65.  
  66.  
  67. dnl Checks for typedefs, structures, and compiler characteristics.
  68. AC_C_CONST
  69.  
  70. AC_TYPE_PID_T
  71.  
  72. dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
  73. AC_DEFUN(BASH_SIGNAL_CHECK,
  74. [AC_REQUIRE([AC_TYPE_SIGNAL])
  75. AC_MSG_CHECKING(for type of signal functions)
  76. AC_CACHE_VAL(bash_cv_signal_vintage,
  77. [
  78.   AC_TRY_LINK([#include <signal.h>],[
  79.     sigset_t ss;
  80.     struct sigaction sa;
  81.     sigemptyset(&ss); sigsuspend(&ss);
  82.     sigaction(SIGINT, &sa, (struct sigaction *) 0);
  83.     sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
  84.   ], bash_cv_signal_vintage=posix,
  85.   [
  86.     AC_TRY_LINK([#include <signal.h>], [
  87.     int mask = sigmask(SIGINT);
  88.     sigsetmask(mask); sigblock(mask); sigpause(mask);
  89.     ], bash_cv_signal_vintage=4.2bsd,
  90.     [
  91.       AC_TRY_LINK([
  92.     #include <signal.h>
  93.     RETSIGTYPE foo() { }], [
  94.         int mask = sigmask(SIGINT);
  95.         sigset(SIGINT, foo); sigrelse(SIGINT);
  96.         sighold(SIGINT); sigpause(SIGINT);
  97.         ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
  98.     )]
  99.   )]
  100. )
  101. ])
  102. AC_MSG_RESULT($bash_cv_signal_vintage)
  103. if test "$bash_cv_signal_vintage" = posix; then
  104. AC_DEFINE(HAVE_POSIX_SIGNALS)
  105. elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
  106. AC_DEFINE(HAVE_BSD_SIGNALS)
  107. elif test "$bash_cv_signal_vintage" = svr3; then
  108. AC_DEFINE(HAVE_USG_SIGHOLD)
  109. fi
  110. ])
  111.  
  112. AC_DEFUN(BASH_REINSTALL_SIGHANDLERS,
  113. [AC_REQUIRE([AC_TYPE_SIGNAL])
  114. AC_REQUIRE([BASH_SIGNAL_CHECK])
  115. AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
  116. AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
  117. [AC_TRY_RUN([
  118. #include <signal.h>
  119. #ifdef HAVE_UNISTD_H
  120. #include <unistd.h>
  121. #endif
  122.  
  123. typedef RETSIGTYPE sigfunc();
  124.  
  125. int nsigint;
  126.  
  127. #ifdef HAVE_POSIX_SIGNALS
  128. sigfunc *
  129. set_signal_handler(sig, handler)
  130.      int sig;
  131.      sigfunc *handler;
  132. {
  133.   struct sigaction act, oact;
  134.   act.sa_handler = handler;
  135.   act.sa_flags = 0;
  136.   sigemptyset (&act.sa_mask);
  137.   sigemptyset (&oact.sa_mask);
  138.   sigaction (sig, &act, &oact);
  139.   return (oact.sa_handler);
  140. }
  141. #else
  142. #define set_signal_handler(s, h) signal(s, h)
  143. #endif
  144.  
  145. RETSIGTYPE
  146. sigint(s)
  147. int s;
  148. {
  149.   nsigint++;
  150. }
  151.  
  152. main()
  153. {
  154.     nsigint = 0;
  155.     set_signal_handler(SIGINT, sigint);
  156.     kill((int)getpid(), SIGINT);
  157.     kill((int)getpid(), SIGINT);
  158.     exit(nsigint != 2);
  159. }
  160. ], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes
  161. AC_MSG_ERROR(cannot check signal handling if cross compiling))])
  162. AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
  163. if test $bash_cv_must_reinstall_sighandlers = yes; then
  164. AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
  165. fi
  166. ])
  167.  
  168. dnl system ZLIB support, nicked from mozilla source
  169. dnl ========================================================
  170. AC_ARG_WITH(zlib,
  171. [  --with-zlib=\$dir        use system libz in \$dir],
  172.     ZLIB_DIR=$withval)
  173.  
  174. _SAVE_CFLAGS=$CFLAGS
  175. _SAVE_LDFLAGS=$LDFLAGS
  176. CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
  177. LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
  178. if test "$ZLIB_DIR" = no; then
  179.     SYSTEM_ZLIB=
  180. else
  181.     AC_MSG_CHECKING("for zlib.h")
  182.     AC_TRY_COMPILE([#include "zlib.h"], [],
  183.     [result="yes" SYSTEM_ZLIB=1],
  184.     [result="no, WARNING mswordview will not be able to decompress wmf files" SYSTEM_ZLIB=0])
  185.     AC_MSG_RESULT("$result") 
  186. fi  
  187. if [ test "$SYSTEM_ZLIB" = 1 ]; then
  188.     AC_DEFINE(SYSTEM_ZLIB)
  189.     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
  190.     [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
  191. fi
  192. CFLAGS=$_SAVE_CFLAGS
  193. LDFLAGS=$_SAVE_LDFLAGS
  194.  
  195. if [ test -n "${ZLIB_DIR}" && test -d "${ZLIB_DIR}" && test "$SYSTEM_ZLIB" = 1 ]; then
  196.     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
  197.     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
  198. fi
  199. dnl ========================================================
  200. dnl end of zlib
  201.  
  202.  
  203. BASH_REINSTALL_SIGHANDLERS
  204.  
  205. dnl check for getopt
  206. AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
  207. AC_CHECK_FUNC(strerror, , [LIBOBJS="$LIBOBJS strerror.o"])
  208. AC_SUBST(LIBOBJS)
  209. AC_SUBST(ZLIB_CFLAGS)
  210. AC_SUBST(ZLIB_LIBS)
  211.  
  212.  
  213. AC_OUTPUT(Makefile oledecod/Makefile)
  214.